import request from '@/utils/request'

// 查询采购记录列表
export function listPurchase(query) {
  return request({
    url: '/business/purchase/list',
    method: 'get',
    params: query
  })
}

// 查询采购记录详细
export function getPurchase(inboundId) {
  return request({
    url: '/business/purchase/' + inboundId,
    method: 'get'
  })
}

// 新增采购记录
export function addPurchase(data) {
  return request({
    url: '/business/purchase',
    method: 'post',
    data: data
  })
}

// 修改采购记录
export function updatePurchase(data) {
  return request({
    url: '/business/purchase',
    method: 'put',
    data: data
  })
}

// 删除采购记录
export function delPurchase(inboundId) {
  return request({
    url: '/business/purchase/' + inboundId,
    method: 'delete'
  })
}

// 采购统计 - 获取统计数据
export function getStatistics(query) {
  return request({
    url: '/business/purchase/statistics',
    method: 'get',
    params: query
  })
}

// 导入采购入库数据
export function importData(data) {
  return request({
    url: '/business/purchase/importData',
    method: 'post',
    data: data
  })
}

// 下载采购入库导入模板
export function importTemplate() {
  return request({
    url: '/business/purchase/importTemplate',
    method: 'post',
    responseType: 'blob'
  })
}